import {useState, useEffect} from 'react'
import {useNavigate} from 'react-router-dom'
import { Sidebar, Image } from 'react-vant'

const SidebarTab = props => {
    const {items, onClickCategoryId} =props
    const [active, setActive] = useState(0)
    return (
        <div className="sidebar-tab">
             <Sidebar
                value={active}
                onChange={(v) => {
                    setActive(v)
                    onClickCategoryId(v);
                }}
            >
                <Sidebar.Item title={'所有选项'} />
                {items&&items.map((item) => (
                    <Sidebar.Item title={item.title} key={item.id} />
                ))}
            </Sidebar>
        </div>
    )
}

export default SidebarTab;